<?PHP

require_once APP_ROOT . "view/pub/myprofile.view.php";
require_once WACT_ROOT . 'view/view.inc.php';
require_once WACT_ROOT . 'controller/controller.inc.php';
require_once WACT_ROOT . 'controller/form.inc.php';
require_once APP_ROOT . "model/common/site.php";

class MyprofileMessagePage extends PageController {
	function MyprofileMessagePage(){
		parent::PageController();

		$Form=new FormController();
		/*
		$Form->addRule(new RequiredRule('oldpassword'));
		$Form->addRule(new RequiredRule('password'));
		$Form->addRule(new RequiredRule('confpswd'));
		$Form->addRule(new MatchRule('password', 'confpswd'));
		*/
		$this->registerOnLoadListener(new Delegate($this, 'onload'));
		$this->addChild('myprofile_form',$Form);
		$this->setDefaultChild('myprofile_form');


        $mytemplate1 = 'pub/myprofile/message.html';


		$this->addView('action',new MyprofileView($mytemplate1,2));
		$this->addView('notlogin',new Handle(APP_ROOT . 'view/common/layout.view.php|NotFoundView', array('/common/notfound.html')));
	}

	function onload(&$source, &$request, &$responseModel){
		if($request->getParameter('type')==1) {
			$responseModel->import(array('message'=>'Item was created successfully.'));
			return 'action';
		}else if($request->getParameter('type')==2){
			$responseModel->import(array('message'=>'Item was saved successfully.'));
			return 'action';
		}
		else return 'notlogin';
	}
}
?>
